package com.mxx.bu_yang.dialog;

import android.widget.TextView;

import com.mxx.bu_yang.R;

import java.util.HashMap;
import java.util.Map;

/**
 * 作者：刘江飞
 * 时间：2020/10/15  9:03
 * 邮箱：642371742Z@qq.com
 * 描述：转交
 **/
public class FriendlyHintDialog extends CancelSureDialog {
    private TextView tv_hint;
    private final Map<String, Object> paramsMap = new HashMap<>();
    private BtnCancelSureListener btnCancelSureListener;

    public void setBtnCancelSureListener(BtnCancelSureListener btnCancelSureListener) {
        this.btnCancelSureListener = btnCancelSureListener;
    }

    /**
     * Sets layout id.
     *
     * @return the layout id
     */
    @Override
    protected int setLayoutId() {
        return R.layout.dialog_friendly_hint;
    }

    @Override
    protected void initView() {
        super.initView();
        tv_hint = mRootView.findViewById(R.id.tv_hint);
        String hint = (String) getSerializableValue("hint");
        paramsMap.put("hint", hint);

    }

    @Override
    protected void initData() {
        super.initData();
        String hint = (String) paramsMap.get("hint");
        tv_hint.setText(hint);
    }

    @Override
    protected void leftBtnCancelClick() {
        super.leftBtnCancelClick();
        if (btnCancelSureListener==null){
            return;
        }
        btnCancelSureListener.cancel();
    }

    @Override
    protected void rightBtnSureClick() {
        dismiss();
        if (btnCancelSureListener==null){
            return;
        }
        btnCancelSureListener.sure();;
    }

    public interface BtnCancelSureListener {
        void cancel();

        void sure();
    }
}
